package cn.mes.module.mes.dal.mysql.basemachineinfo;

import java.util.*;

import cn.mes.framework.common.pojo.PageResult;
import cn.mes.framework.common.pojo.PageParam;
import cn.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.mes.framework.mybatis.core.mapper.BaseMapperX;
import cn.mes.module.mes.dal.dataobject.basemachineinfo.BaseDeviceDataDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 设备数据 Mapper
 *
 * @author 游创
 */
@Mapper
public interface BaseDeviceDataMapper extends BaseMapperX<BaseDeviceDataDO> {

    default PageResult<BaseDeviceDataDO> selectPage(PageParam reqVO, String deviceId) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BaseDeviceDataDO>()
            .eq(BaseDeviceDataDO::getDeviceId, deviceId)
            .orderByDesc(BaseDeviceDataDO::getCreateTime));
    }

    default int deleteByDeviceId(String deviceId) {
        return delete(BaseDeviceDataDO::getDeviceId, deviceId);
    }

}
